<?php
/* 
 *  Global(registry) class
 */

class Registry {
    
    private $vars = array();

    public function __construct($db) {
        $this->vars['db'] = $db;
    }

    public function set($name,$val){
        if(isset($this->vars[$name])) {
            throw new Exception('Unable to set var `' . $key . '`. Already set.');
        }
        $this->vars[$name] = $val;
        return TRUE;
    }

    public function get($name) {
        if(!isset($this->vars[$name])) {
            return null;
        }

        return $this->vars[$name];
    }

    public function del($name) {
        unset($this->vars[$name]);
    }
}

?>
